﻿<%@ Page Title="" Language="C#" CodeFile="Inventory_In.aspx.cs" MasterPageFile="~/MasterPage.master"
    Inherits="Inventory_In" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <title>采购</title>
    <link href="../resources/styles/style.css" type="text/css" rel="stylesheet">
    <script src="../JavaScript/common.js" type="text/javascript"></script>
    <script src="../JavaScript/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
    <script type="text/javascript">
        var returnValue = "";
        function SelectProduct() {
            window.showModalDialog("SelectProduct.aspx", window, "dialogWidth=600px;dialogHeight=700px;center:yes;status:no;scroll:no;help:no");

        }

        function ShowValue() {
            //提交至到服务器端
            if (returnValue != undefined) {
                window.document.getElementById('ProductID').value = returnValue;
                // ProductID.value = returnValue;
                __doPostBack("SelectProduct", returnValue);
                Submit("aaa");
            }
            else {
                window.document.getElementById('ProductID').value = "";
                // ProductID.value = "";
            }

        }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <input type="hidden" id="ProductID" name="ProductID" />
    <div>
        <asp:UpdatePanel runat="server" ID="UpdatePanel1">
            <ContentTemplate>
                <table id="wsd_inputtable">
                    <tr>
                        <td colspan="3" class="tabletitle">
                            <font color="red" size="2"><b>提示:*为必填项</b></font>
                        </td>
                    </tr>
                    <tr>
                        <td class="tablefield" style="width: 30%; height: 30px;">
                            <span class="keyword">*</span>日期:
                        </td>
                        <td class="style1">
                            <asp:TextBox ID="txtDate" runat="server" onfocus="WdatePicker()" MaxLength="10" class="default"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td class="tablefield" style="width: 30%">
                            <span class="keyword">*</span>采购单号:
                        </td>
                        <td nowrap="nowrap" class="style2">
                            <asp:TextBox ID="txtCode" runat="server" ReadOnly="false" class="default"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td class="tablefield" style="width: 30%">
                            <span class="keyword">*</span>往来单位:
                        </td>
                        <td class="style2" nowrap="nowrap">
                            <asp:DropDownList ID="ddlSupply" runat="server" Width="150" DataTextField="NAME"
                                DataValueField="ID">
                            </asp:DropDownList>
                        </td>
                    </tr>
                    <tr>
                        <td class="tablefield" style="width: 30%">备注:
                        </td>
                        <td class="style2" nowrap="nowrap">
                            <asp:TextBox ID="txtRemark" TextMode="MultiLine" Rows="3" Columns="80" MaxLength="128" Width="240px" runat="server" class="default"></asp:TextBox>
                        </td>
                    </tr>
                </table>

                <table id="wsd_inputtable">
                    <tr>
                        <td class="tabletitle">
                            <b>采购商品明细</b>
                        </td>
                    </tr>
                    <tr>
                        <td class="buttonarea">
                            <input type="button" class="wsd_button2" onclick="SelectProduct();" value="添加商品" />
                        </td>
                    </tr>
                </table>
                <table id="wsd_listtable">
                    <tr>
                        <td style="width: 100%">
                            <asp:GridView Width="100%" ID="GridView" runat="server" DataKeyNames="CODE" AutoGenerateColumns="false"
                                OnRowDataBound="Grid_RowDataBound" EmptyDataRowStyle-Font-Bold="true" EmptyDataRowStyle-HorizontalAlign="Center"
                                EnableEmptyContentRender="true" AllowPaging="False"
                                OnRowDeleting="GridView_RowDeleting">
                                <HeaderStyle CssClass="titlist" />
                                <EmptyDataRowStyle HorizontalAlign="Center" Font-Bold="True"></EmptyDataRowStyle>
                                <Columns>
                                    <asp:BoundField HeaderText="细目编号" DataField="CODE" />
                                    <asp:TemplateField HeaderText="仓库名称">
                                        <ItemTemplate>
                                            <asp:DropDownList runat="server" DataValueField="ID" DataTextField="DESCRIPTION" class="default" ID="ddlWareHouse">
                                            </asp:DropDownList>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:BoundField DataField="ProductName" HeaderText="商品" ReadOnly="true" />
                                    <asp:TemplateField HeaderText="计量单位">
                                        <ItemTemplate>
                                            <asp:DropDownList runat="server" class="default" ID="ddlUOM">
                                            </asp:DropDownList>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="数量">
                                        <ItemTemplate>
                                            <asp:TextBox ID="txtQuantity" AutoPostBack="true" MaxLength="4" OnTextChanged="TextChanged" Width="50px" Text='<%# Eval("Quantity") %>' runat="server" class="default" />
                                            <asp:RequiredFieldValidator runat="server" ControlToValidate="txtQuantity"
                                                ErrorMessage="请输入数量" Display="Dynamic" />
                                            <asp:RangeValidator  runat="server" ControlToValidate="txtQuantity"
                                                 Display="Dynamic" MaximumValue="9999" MinimumValue="1"
                                                ErrorMessage="数量输入范围在1~9999"
                                                 Type="Currency"/>
                                            <asp:RegularExpressionValidator ID="rev3" runat="server" ControlToValidate="txtQuantity"
                                                Display="Dynamic" ErrorMessage="数量应为数字!" ValidationExpression="^(\d{1,3}(,\d\d\d)*(\.\d+)?|\d+(\.\d+)?)$" />
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="采购价(元)">
                                        <ItemTemplate>
                                            <asp:TextBox ID="txtPiecePrice" AutoPostBack="true" MaxLength="6" OnTextChanged="TextChanged" Width="50px" Text='<%# Eval("PIECE_PRICE") %>' runat="server"
                                                class="default" />
                                              <asp:RequiredFieldValidator runat="server" ControlToValidate="txtPiecePrice"
                                                ErrorMessage="请输入采购价" Display="Dynamic" />
                                            <asp:RangeValidator ID="RangeValidator1"  runat="server" ControlToValidate="txtPiecePrice"
                                                 Display="Dynamic" MaximumValue="999" MinimumValue="1"
                                                ErrorMessage="采购价范围在1~999元"
                                                 Type="Currency"/>
                                            <asp:RegularExpressionValidator  runat="server" ControlToValidate="txtPiecePrice"
                                                Display="Dynamic" ErrorMessage="采购价应为数字!" ValidationExpression="^(\d{1,3}(,\d\d\d)*(\.\d+)?|\d+(\.\d+)?)$" />
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="金额(元)">
                                        <ItemTemplate>
                                            <asp:TextBox ID="txtAmount" AutoPostBack="true" OnTextChanged="TextChanged" Width="80px" Text='<%# Eval("LINE_AMOUNT") %>' runat="server" class="default" />
                                            <asp:RequiredFieldValidator runat="server" ControlToValidate="txtAmount"
                                                ErrorMessage="请输入金额" Display="Dynamic" />
                                            <asp:RangeValidator runat="server" ControlToValidate="txtAmount"
                                                 Display="Dynamic" MaximumValue="99999" MinimumValue="1"
                                                ErrorMessage="金额范围在1~99999元"
                                                 Type="Currency"/>
                                            <asp:RegularExpressionValidator runat="server" ControlToValidate="txtAmount"
                                                Display="Dynamic" ErrorMessage="金额应为数字!" ValidationExpression="^(\d{1,3}(,\d\d\d)*(\.\d+)?|\d+(\.\d+)?)$" />
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:ButtonField HeaderText="操作" ButtonType="Button" Text="删除" CausesValidation="false" CommandName="Delete" ControlStyle-CssClass="wsd_button2" />

                                </Columns>
                                <RowStyle CssClass="evenline" />
                                <AlternatingRowStyle CssClass="oddline" />
                                <PagerSettings Visible="false" />
                            </asp:GridView>
                        </td>
                    </tr>
                </table>

                <table id="wsd_inputtable">
                    <tr>
                        <td class="tablefield" style="width: 30%">应付金额(元):
                        </td>
                        <td nowrap="nowrap" class="style2">
                            <asp:TextBox ID="txtAmount1" ReadOnly="true" runat="server" class="default"></asp:TextBox>
                        </td>
                        <td class="tablefield" style="width: 30%">
                            <span class="keyword">*</span>实付金额(元):
                        </td>
                        <td nowrap="nowrap" class="style2">
                            <asp:TextBox ID="txtAmount2" runat="server" class="default"></asp:TextBox>
                        </td>
                    </tr>
                </table>
                <table id="wsd_inputtable">
                    <tr>
                        <td class="tabletitle" width="100%">操作选项 
                        </td>
                    </tr>
                    <tr>
                        <td class="buttonarea">
                            <asp:Button ID="btnSave" runat="server" class="wsd_button2"
                                OnClick="btnSave_Click" Text="提  交" />
                            &nbsp;&nbsp;
                            <input id="Button15" class="wsd_button2" name="Button2"
                                onclick="location.href = 'Inventory_List.aspx'" type="button" value="返   回">
                            </input>
                        </td>
                    </tr>
                </table>
                
            </ContentTemplate>
        </asp:UpdatePanel>
    </div>
</asp:Content>
